/*
 * trace_FuncStackInfo.c
 *
 *  Created on: 2012/08/06
 *      Author: guanxiaoying
 */
#include "../table.h"
#include "../trace_cmd_table.h"
/*TRACE_STACKINFO	*/
typedef struct _FUNCSTACKINFO
{

	UCHAR       loopFlg;
	AST         astCmdList;
	AST         astCmdNext;
	AST         astPath;
	AST         astNextPath;
	AST         astPathParam;
	AST         astLoop;
	AST         astVariBlock;
	AST			astFunc;
	AST			astPathStk;
	AST			astLoopStk;
	AST			astPathStkMax;
	AST			astLoopStkMax;
	AST			astParamMax;
} FUNCSTACKINFO, *PFUNCSTACKINFO;

#define TableSize  (sizeof(FUNCSTACKINFO ))
#define TableType  PFUNCSTACKINFO
#define stTable stFunctionStackInfoManager.memoryBlocks
#define maxTable stFunctionStackInfoManager.maxRecordNum
#define  maxNumPerBlk  (stFunctionStackInfoManager.astMaxNum_Block)


static TABLEMANAGER stFunctionStackInfoManager = {
//		U4                  usIdx;
		0,
//		PSZ				    con_pszName;    constant
		__FILE__,
//		U2					con_usSize;		constant
		TableSize,
//		U2					block_num;	　　　　　　　Reset clear  際　要
		0,
//		S4					astMaxNum_Block;     １回設定のみ
		0,
//		S4					astTabNum_LastPage; 　　　　Reset clear  際　要
		0,
//		S4					astMaxNum_LastPage;     Reset clear  際　要
		0,
//		U4					ulMaxByte;	　　　　　　　　　　クリアしない
		0,
//		U4					con_minPageSize;　　　　　　　　　　constant
		0
};
static VOID resetListener( U4  procid, U2 index )
{
	if( procid == stFunctionStackInfoManager.u4Idx )
	{
		if( index > 0 && index < MAX_VOLUMN_OF_TABLE )
		{
			stTable[ index-1] = NULL;
		}
	}
}
static TableType core_getTable( AST index )
{
	TableType temp = (TableType)Check_Com( &stFunctionStackInfoManager, resetListener,  index );
	if( temp != NULL ){ return &temp[index%maxNumPerBlk]; } return NULL;
}
static BOOL ClearTable( VOID )
{
	return Clear_Com( &stFunctionStackInfoManager );
}
static BOOL AllocTable( AST astReqArg )
{
	return AllocTable_Com( &stFunctionStackInfoManager, astReqArg, resetListener );
}
static AST getMaxLineNum( VOID ){
	return maxTable;
}
static U2 getLoopFlg( AST astIndex ){
	TableType pTbl = core_getTable( astIndex );
	if( pTbl == NULL )
	{
		return 0;
	}
	return pTbl->loopFlg;
}
static U2 setLoopFlg( AST astIndex, U2 value ){
	TableType pTbl = core_getTable( astIndex );
	if( pTbl == NULL )
	{
		return 0;
	}
	return pTbl->loopFlg=value;
}
static AST getCmdList( AST astIndex ){
	TableType pTbl = core_getTable( astIndex );
	if( pTbl == NULL )
	{
		return 0;
	}
	return pTbl->astCmdList;
}
static AST setCmdList( AST astIndex, AST value ){
	TableType pTbl = core_getTable( astIndex );
	if( pTbl == NULL )
	{
		return 0;
	}
	return pTbl->astCmdList=value;
}
static AST getNextCmdList( AST astIndex ){
	TableType pTbl = core_getTable( astIndex );
	if( pTbl == NULL )
	{
		return 0;
	}
	return pTbl->astCmdNext;
}
static AST setNextCmdList( AST astIndex, AST value ){
	TableType pTbl = core_getTable( astIndex );
	if( pTbl == NULL )
	{
		return 0;
	}
	return pTbl->astCmdNext=value;
}
static AST getPath( AST astIndex ){
	TableType pTbl = core_getTable( astIndex );
	if( pTbl == NULL )
	{
		return 0;
	}
	return pTbl->astPath;
}
static AST setPath( AST astIndex, AST value ){
	TableType pTbl = core_getTable( astIndex );
	if( pTbl == NULL )
	{
		return 0;
	}
	return pTbl->astPath=value;
}
static AST getNextPath( AST astIndex ){
	TableType pTbl = core_getTable( astIndex );
	if( pTbl == NULL )
	{
		return 0;
	}
	return pTbl->astNextPath;
}
static AST setNextPath( AST astIndex, AST value ){
	TableType pTbl = core_getTable( astIndex );
	if( pTbl == NULL )
	{
		return 0;
	}
	return pTbl->astNextPath=value;
}
static AST getPathParam( AST astIndex ){
	TableType pTbl = core_getTable( astIndex );
	if( pTbl == NULL )
	{
		return 0;
	}
	return pTbl->astPathParam;
}
static AST setPathParam( AST astIndex, AST value ){
	TableType pTbl = core_getTable( astIndex );
	if( pTbl == NULL )
	{
		return 0;
	}
	return pTbl->astPathParam=value;
}
static AST getLoop( AST astIndex ){
	TableType pTbl = core_getTable( astIndex );
	if( pTbl == NULL )
	{
		return 0;
	}
	return pTbl->astLoop;
}
static AST setLoop( AST astIndex, AST value ){
	TableType pTbl = core_getTable( astIndex );
	if( pTbl == NULL )
	{
		return 0;
	}
	return pTbl->astLoop=value;
}
static AST getCurrentObj( AST astIndex ){
	TableType pTbl = core_getTable( astIndex );
	if( pTbl == NULL )
	{
		return 0;
	}
	return pTbl->astFunc;
}
static AST setCurrentObj( AST astIndex, AST value ){
	TableType pTbl = core_getTable( astIndex );
	if( pTbl == NULL )
	{
		return 0;
	}
	return pTbl->astFunc=value;
}
static AST getPathStk( AST astIndex ){
	TableType pTbl = core_getTable( astIndex );
	if( pTbl == NULL )
	{
		return 0;
	}
	return pTbl->astPathStk;
}
static AST setPathStk( AST astIndex, AST value ){
	TableType pTbl = core_getTable( astIndex );
	if( pTbl == NULL )
	{
		return 0;
	}
	return pTbl->astPathStk=value;
}
static AST getPathStkMax( AST astIndex ){
	TableType pTbl = core_getTable( astIndex );
	if( pTbl == NULL )
	{
		return 0;
	}
	return pTbl->astPathStkMax;
}
static AST setPathStkMax( AST astIndex, AST value ){
	TableType pTbl = core_getTable( astIndex );
	if( pTbl == NULL )
	{
		return 0;
	}
	return pTbl->astPathStkMax=value;
}
static AST getLoopStk( AST astIndex ){
	TableType pTbl = core_getTable( astIndex );
	if( pTbl == NULL )
	{
		return 0;
	}
	return pTbl->astLoopStk;
}
static AST setLoopStk( AST astIndex, AST value ){
	TableType pTbl = core_getTable( astIndex );
	if( pTbl == NULL )
	{
		return 0;
	}
	return pTbl->astLoopStk=value;
}
static AST getLoopStkMax( AST astIndex ){
	TableType pTbl = core_getTable( astIndex );
	if( pTbl == NULL )
	{
		return 0;
	}
	return pTbl->astLoopStkMax;
}
static AST setLoopStkMax( AST astIndex, AST value ){
	TableType pTbl = core_getTable( astIndex );
	if( pTbl == NULL )
	{
		return 0;
	}
	return pTbl->astLoopStkMax=value;
}
static AST getPathParamMax( AST astIndex ){
	TableType pTbl = core_getTable( astIndex );
	if( pTbl == NULL )
	{
		return 0;
	}
	return pTbl->astParamMax;
}
static AST setPathParamMax( AST astIndex, AST value ){
	TableType pTbl = core_getTable( astIndex );
	if( pTbl == NULL )
	{
		return 0;
	}
	return pTbl->astParamMax=value;
}
const FUNCSTACKINFOACCESS  stFuncStkAccess ={
		ClearTable,
		AllocTable,
		getMaxLineNum,


		{
				getLoopFlg,
				setLoopFlg
		},
		{
				getCmdList,
				setCmdList
		},
		{
				getNextCmdList,
				setNextCmdList
		},
		{
				getPath,
				setPath
		},
		{
				getNextPath,
				setNextPath
		},
		{
				getPathParam,
				setPathParam
		},
		{
				getLoop,
				setLoop
		},
		{
				getCurrentObj,
				setCurrentObj
		},
		{
				getPathStk,
				setPathStk
		},
		{
				getLoopStk,
				setLoopStk
		},
		{
				getPathStkMax,
				setPathStkMax
		},
		{
				getLoopStkMax,
				setLoopStkMax
		},
		{
				getPathParamMax,
				setPathParamMax
		}
};


